#include "cute.h"
#include "ide_listener.h"
#include "cute_runner.h"
#include "circleTest.h"

#include <physics>

using physics::scalar;
using physics::vector;
using physics::Circle;

namespace
{
void genCollideTest()
{
	Circle c(2);
	ASSERT(!c.getCollision(c));
}

void integrateTest()
{
	vector p, v;
	p.randu();
	v.randu();
	scalar t = .65, m = 3;
	Circle c(p, v, m, m);
	c.integrate(t);
	p += (v * t);
	ASSERT_EQUAL(p.size(), arma::accu(p == c.position));
}

void supportTest()
{
	static const uint size = 5;
	Circle c(0, size);
	vector expected("0 " + std::to_string(size) + " 0");
	vector res = c.getSupport("0 1 0");
	ASSERT_EQUALM("Wrong support", 3, arma::as_scalar(arma::sum(expected == res)));
}

} // namespace

cute::suite make_suite_circleTest()
{
	cute::suite s;
	s.push_back(CUTE(genCollideTest));
	s.push_back(CUTE(integrateTest));
	s.push_back(CUTE(supportTest));
	return s;
}

